//package cn.iocoder.yudao.module.handguard.tool.http;
//
//import org.opencv.core.Core;
//import org.opencv.core.CvType;
//import org.opencv.core.Mat;
//import org.opencv.core.Scalar;
//import org.opencv.imgcodecs.Imgcodecs;
//import org.opencv.imgproc.Imgproc;
//
//public class ImageProcessorOpenCV {
//
//    static {
//        // 加载OpenCV的本地库
//        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
//    }
//
//    public static Mat grayScale(Mat image) {
//        Mat grayImage = new Mat();
//        Imgproc.cvtColor(image, grayImage, Imgproc.COLOR_BGR2GRAY);
//        return grayImage;
//    }
//
//    public static Mat binaryThreshold(Mat image, int threshold) {
//        Mat binaryImage = new Mat();
//        Imgproc.threshold(image, binaryImage, threshold, 255, Imgproc.THRESH_BINARY);
//        return binaryImage;
//    }
//
//    public static Mat gaussianBlur(Mat image, int kernelSize, double sigma) {
//        Mat blurredImage = new Mat();
//        Imgproc.GaussianBlur(image, blurredImage, new org.opencv.core.Size(kernelSize, kernelSize), sigma);
//        return blurredImage;
//    }
//
//    public static void main(String[] args) {
//        Mat originalImage = Imgcodecs.imread("/Users/handsome/LDFC/img/ca0b973bb6b47ef76ca569d8ae856599.jpeg");
//        Mat grayImage = grayScale(originalImage);
//        Mat blurredImage = gaussianBlur(grayImage, 5, 0); // 0表示sigma由kernelSize自动计算
//        Mat binaryImage = binaryThreshold(blurredImage, 128);
//
//        // 保存或显示处理后的图片
//        Imgcodecs.imwrite("path_to_gray_image.jpg", grayImage);
//        Imgcodecs.imwrite("path_to_blurred_image.jpg", blurredImage);
//        Imgcodecs.imwrite("path_to_binary_image.jpg", binaryImage);
//    }
//}